<div class="orgInfo">
    <div class="tree">
        <h2>机构列表</h2>
        <div dx-tree-view="treeViewConfig"></div>
    </div>
    <div class="view">
        <h2 ng-hide="orgInfo.province">下属机构表<span class="record-count">(共<span ng-bind="orgGridConfig.dataSource.length"></span>个机构)</span></h2>
        <a  class="btn btn-primary" ng-click="createOrg()" ng-if="userInfo.role == 2" ng-hide="orgInfo.province">新建</a>
        <div dx-data-grid="orgGridConfig" ng-hide="orgInfo.province">
            <div data-options="dxTemplate: { name: 'statusCellTemplate' }">
                <span  ng-class="{true: 'green', false: 'red'}[data.status == 10]">{{data.status == 10 ? '正常':'冻结'}}</span>
            </div>
            <div data-options="dxTemplate: { name: 'operationCellTemplate' }">
                <div class="operation">
                    <a ng-click="$parent.showOrgInfo(data)"><i></i>查看</a>
                    <a ng-if="$parent.userInfo.role == 2" ng-click="$parent.$parent.editOrgInfo(data)"><i></i>编辑</a>
                    <a ng-if="$parent.userInfo.role == 2" ng-click="$parent.$parent.updateStatus(data)"><i></i>{{data.status != 10 ? '解冻':'冻结'}}</a>
                </div>
            </div>
        </div>
        <h2 ng-show="orgInfo.province">机构详情</h2>
        <form class="form-horizontal" ng-show="orgInfo.province" ng-submit="saveOrg()">
            <div class="form-inline col-sm-12" ng-if="type == 'view'">
                <div class="col-xs-6 form-group">
                    <label for="onePass" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        组织一号通
                    </label>
                    <input type="text" ng-model="orgInfo.onePass" ng-disabled="true" class="form-control" id="onePass" required autofocus tabindex="1"/>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-6 form-group">
                    <label for="orgName" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        组织名称
                    </label>
                    <input type="text" ng-model="orgInfo.orgName" ng-disabled="type == 'view'" class="form-control" id="orgName" required tabindex="2"/>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-6 form-group">
                    <label for="orgCode" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        机构代码/信用代码
                    </label>
                    <input type="text" ng-model="orgInfo.orgCode" ng-disabled="type == 'view'" class="form-control" id="orgCode" required tabindex="3"/>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-sm-6 form-group">
                    <label for="province" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        地址信息
                    </label>
                    <select class="form-control" ng-model="orgInfo.province" id="province" ng-options="item.ProID as item.ProName for item  in province" ng-disabled="type == 'view'" tabindex="4" ng-change="provinceChange()">
                    </select>
                </div>
                <div class="col-sm-6 form-group">
                    <select class="form-control" ng-model="orgInfo.city" id="city" ng-options="item.CityID as item.CityName for item  in currCityList" ng-disabled="type == 'view'" tabindex="5" style="width: inherit;" ng-change="cityChange()">
                    </select>
                    <select class="form-control" ng-model="orgInfo.county" id="District" ng-options="item.Id as item.DisName for item  in currDistrictList" ng-disabled="type == 'view'" tabindex="6" style="width: inherit;">
                    </select>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-8 form-group" style="height: 100px">
                    <label for="address" class="text-right" style="line-height: 100px">
                    <span class="required-color">
                        *
                    </span>
                        详细地址
                    </label>
                    <textarea cols="30" rows="10" ng-model="orgInfo.address" ng-disabled="type == 'view'" class="form-control" id="address" required tabindex="7" style="height: 100px"></textarea>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-6 form-group">
                    <label for="zipCode" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        邮政编码
                    </label>
                    <input type="text" pattern="[1-9]\d{5}(?!\d)" title="请输入正确的邮政编码"   ng-model="orgInfo.zipCode" ng-disabled="type == 'view'" class="form-control" id="zipCode" required tabindex="8"/>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-6 form-group">
                    <label for="principal" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        负责人姓名
                    </label>
                    <input type="text" ng-model="orgInfo.principal" ng-disabled="type == 'view'" class="form-control" id="principal" required tabindex="9"/>
                </div>
            </div>
            <div class="form-inline col-sm-12">
                <div class="col-xs-6 form-group">
                    <label for="phone" class="text-right">
                    <span class="required-color">
                        *
                    </span>
                        负责人手机
                    </label>
                    <input type="text" pattern="1[\d]{10}" title="请输入正确的手机号" ng-model="orgInfo.phone" ng-disabled="type == 'view'" class="form-control" id="phone" required tabindex="10"/>
                </div>
            </div>
            <div class="form-inline col-xs-12 form-footer">
                <div class="col-sm-12">
                    <a class="col-sm-offset-3 col-sm-2 btn btn-primary" ng-click="orgInfo = {}">返回</a>
                    <input type="submit" value="提交" class="col-sm-offset-1 col-sm-2 btn btn-primary" ng-if="type != 'view'"/>
                </div>
            </div>
        </form>
    </div>
</div>
